/**
 * Advanced Software Engineering - assignment part 1 (monica Farrow)
 * UncollectedParcelDaysComparator class
 * 
 * The structure of this class has been based on lecture notes provided by
 * Monica Farrow as a part of Software Engineering courses at Heriot-Watt University.
 */

package depot;

import java.util.Comparator;

public class UncollectedParcelDaysComparator implements Comparator<Parcel> {

	/** 
	 * returns an int - 1, 0, or -1
	 * resulting from the comparison of the two Parcel objects
	 * allowing them to be places in days in depot order
	 * @return the comparison int
	 */	
    public int compare(Parcel p1, Parcel p2) {
 	     //encapsulate p1 object into an instance of Integer
 	     Integer p = new Integer(p2.getDays());
 	     // compare p with p2 and return the ID
         return p.compareTo(p1.getDays());
   }
}